<DIV>NN all   IE all   HTML 3.2
<DIV>...</DIV>End Tag: Required
 

The DIV element gives structure and context to any block-level content in a document. Unlike some other structural elements that have very specific connotations attached to them (the P element, for instance), the author is free to give meaning to each particular DIV element by virtue of the element's attribute settings and nested content. Each DIV element becomes a generic block-level container for all content within the required start and end tags.

As a basic example, the DIV element is now recommended as the element to use to center text on a page, in place of the deprecated CENTER element. The DIV element that does the work includes style information that takes care of the centering of the content. It is also convenient to use the DIV element as a wrapper for multielement content that is to be governed by a single style sheet rule. For example, if a block of content includes three paragraphs, rather than assign a special font style to each of the P elements, you can wrap all three P elements with a single DIV element whose style sheet defines the requested font style. Such a style sheet could be defined as an inline STYLE attribute of the DIV element or assigned via the CLASS or ID attribute, depending on the structure of the rest of the document.

DIV elements are block-level elements. If you need an arbitrary container for inline content, use the SPAN element, instead.

HTML 4.0 defines many more attributes for the DIV element than are implemented in Version 4 browsers. The breadth of HTML attributes indicates the potential power of this generic element to include links to related resources and many advisory attributes about those links. The same set of attributes applies to the SPAN element in the HTML 4.0 specification.

 
Example
<DIV CLASS="sections" ID="section3">...</DIV>
 
Object Model Reference
IE [window.]document.all.elementID
ALIGNNN 2   IE 3   HTML 3.2
ALIGN="alignmentConstant"Optional
 

The ALIGN attribute determines how content wrapped by the DIV element is aligned within the context of the DIV element. This attribute is deprecated in favor of the text-align style sheet attribute. Even so, you can use this attribute for backward compatibility with non-CSS-compliant browsers. This is the element and attribute you can use to substitute for the deprecated CENTER element.

 
Example
<DIV ALIGN="center">Part IV</DIV>
 
Value
Case-insensitive constant value. Navigator 4 and Internet Explorer 4 (Windows) recognize all four constants specified in HTML 4: center | left | right | justify. IE 4 for the Macintosh does not recognize the justify setting.
 
Default left or right, depending on direction of current language.
 
Object Model Reference
IE [window.]document.all.elementID.align
CHARSETNN n/a   IE n/a   HTML 4
CHARSET="characterSet"Optional
 

Character encoding of the content at the other end of the HREF link.

 
Example
<DIV CHARSET="csISO5427Cyrillic ">CyrillicTextHere</DIV>
 
Value
Case-insensitive alias from the character set registry (ftp://ftp.isi.edu/in-notes/iana/ assignments/character-sets).
 
Default Determined by browser.
DATAFLDNN n/a   IE 4   HTML n/a
DATAFLD="columnName"Optional
 

Used with IE 4 data binding to associate a remote data source column name with the HTML content of a DIV element. The data source column must be HTML (see DATAFORMATAS). DATASRC and DATAFORMATAS attributes must also be set for the DIV element.

 
Example
<DIV  DATASRC="#DBSRC3" DATAFLD="sec3" DATAFORMATAS="HTML"> </DIV>
 
Value
Case-sensitive identifier.
 
Default None.
 
Object Model Reference
IE [window.]document.all.elementID.dataFld
DATAFORMATASNN n/a   IE 4   HTML n/a
DATAFORMATAS="dataType"Optional
 

Used with IE 4 data binding, this attribute advises the browser whether the source material arriving from the data source is to be treated as plain text or as tagged HTML. A DIV element should receive data only in HTML format.

 
Example
<DIV  DATASRC="#DBSRC3" DATAFLD="sec3" DATAFORMATAS="HTML"> </DIV>
 
Value
IE 4 recognizes two possible settings: text | HTML
 
Default text
 
Object Model Reference
IE [window.]document.all.elementID.dataFormatAs
DATASRCNN n/a   IE 4   HTML n/a
DATASRC="dataSourceName"Optional
 

Used with IE 4 data binding to specify the name of the remote ODBC data source (such as an Oracle or SQL Server database) to be associated with the element. Content from the data source is specified via the DATAFLD attribute.

 
Example
<DIV  DATASRC="#DBSRC3" DATAFLD="sec3" DATAFORMATAS="HTML"> </DIV>
 
Value
Case-sensitive identifier.
 
Default None.
 
Object Model Reference
IE [window.]document.all.elementID.dataSrc
HREFNN n/a   IE n/a   HTML 4
HREF="URI"Optional
 

According to the HTML 4.0 specification, the HREF attribute is meant to offer a URL to a resource that can supply "more information" about the DIV element's content. No recommendation is provided as to whether this URL should be rendered in any way (like the HREF attribute of an A element). Perhaps a future browser could use this URL to generate a margin note or footnote in the form of a link. Several other attributes clearly intend for the HREF attribute's URL to be accessible in some way by the user.

 
Example
<DIV HREF="bibliogs/chap3.html">ChapterThreeContentHere</DIV>
 
Value
Any valid URL, including complete and relative URLs, anchors on the same page (anchor names prefaced with the # symbol) and the javascript: pseudo-URL in scriptable browsers to trigger a script statement rather than navigate to a destination.
 
Default None.
HREFLANGNN n/a   IE n/a   HTML 4
HREFLANG="languageCode"Optional
 

The language code of the content at the destination of a link. Requires that the HREF attribute also be set. This attribute is primarily an advisory attribute to help a browser prepare itself for a new language set if the browser is so enabled.

 
Example
<DIV HREFLANG="HI" HREF="bibliogs/hindi/chap3.html">
ChapterThreeContentinHindiHere
</DIV>
 
Value
Case-insensitive language code.
 
Default Browser default.
MEDIANN n/a   IE n/a   HTML 4
MEDIA="descriptorList"Optional
 

Sets the intended output device for the content of the DIV element. The MEDIA attribute looks forward to the day when browsers are able to tailor content to specific kinds of devices such as pocket computers, text-to-speech digitizers, or fuzzy television sets. The HTML 4.0 specification defines a number of constant values for anticipated devices, but the list is open-ended, allowing future browsers to tailor output to yet other kinds of media and devices.

 
Example
<DIV MEDIA="screen, tv, handheld">...</DIV>
 
Value
Case-sensitive constant values. Multiple values can be grouped together in a comma-delimited list within a quoted string. Values defined in HTML 4.0 are screen | tty | tv | projection | handheld | print | braille | aural | all.
 
Default screen
RELNN n/a   IE n/a   HTML 4
REL="linkTypes"Optional
 

Defines the relationship between the current element and the destination of the link. Also known as a forward link, not to be confused in any way with the destination document whose address is defined by the HREF attribute. The HTML 4.0 recommendation defines several link types; it is up to the browser to determine how to employ the value. The element must include an HREF attribute for the REL attribute to be applied.

 
Example
<DIV REL="next chapter" HREF="chapter3.html">...</DIV>
 
Value
Case-insensitive, space-delimited list of HTML 4.0 standard link types applicable to the element. Sanctioned link types are:
alternate contents index start
appendix copyright next stylesheet
bookmark glossary prev subsection
chapter help section
 
Default None.
REVNN n/a   IE n/a   HTML 4
REV="linkTypes"Optional
 

A reverse link relationship. Like the REL attribute, the REV attribute's capabilities are defined by the browser, particularly with regard to how the browser interprets and renders the various link types available in the HTML 4.0 specification. Given two documents (A and B) containing links that point to each other, the REV value of B is designed to express the same relationship between the two documents as denoted by the REL attribute in A.

 
Example
<DIV REV="previous chapter" HREF="chapter2.html">...</DIV>
 
Value
Case-insensitive, space-delimited list of HTML 4.0 standard link types applicable to the element. See the REL attribute for sanctioned link types.
 
Default None.
TARGETNN n/a   IE n/a   HTML 4
TARGET="windowOrFrameName"Optional
 

If the destination document associated with the HREF attribute is to be loaded into a window or frame other than the current window or frame, you can specify where the destination document should load by assigning a window or frame name to the TARGET attribute. Target frame names must be assigned to frames and windows as identifiers. Assign names to frames via the NAME attribute of the FRAME element; assign names to new windows via the second parameter of the window.open() scripting method. If you omit this attribute, the destination document replaces the document containing the link. This attribute is applicable only when a value is assigned to the HREF attribute of the element.

If this feature is implemented in future browsers, the DIV element will probably have only one destination document and one target (like the A element). If you want a link to change the content of multiple frames, you can use a DIV element's onClick event handler or a javascript: pseudo-URL to fire a script that loads multiple documents. Set the location.href property of each frame to the desired URL.

 
Example
<DIV TARGET="display" HREF="chap3.html#sec2">...</DIV>
 
Value
Case-sensitive identifier when the frame or window name has been assigned via the target element's NAME attribute. Four reserved target names act as constants:
_blank Browser creates a new window for the destination document.
_parent Destination document replaces the current frame's framesetting document (if one exists; otherwise, it is treated as _self).
_self Destination document replaces the current document in its window or frame.
_top Destination document is to occupy the entire browser window, replacing any and all framesets that may be loaded (also treated as _self if there are no framesets defined in the window).
 
Default _self
TITLENN n/a   IE 4   HTML 4
TITLE="advisoryText"Optional
 

An advisory description of the destination document. Internet Explorer 4 implements this attribute such that the browser displays a tooltip with the attribute's value when the cursor remains positioned over the element for a couple of seconds. The appearance of the tooltip is governed by the operating system version of the browser. In Windows, the tooltip is the standard small, light yellow rectangle; on the Mac, the tooltip displays as a cartoon bubble in the manner of the MacOS bubble help system. If no attribute is specified, the tooltip does not display.

Use this attribute with care. Because a DIV element can be fairly large, it is likely that the cursor will frequently be at rest over the element when the user isn't particularly paying attention. The incessant display of the tooltip over the large screen area could become annoying.

You can assign any descriptive text you like to this attribute. Not everyone will see it, so do not put mission-critical information here. Future or special-purpose browsers might use this attribute's information to read information about the link to vision-impaired web surfers.

 
Example
<DIV TITLE="Sub-Saharan Africa" HREF="chapter3.html">...</DIV>
 
Value
Any string of characters. The string must be inside a matching pair of (single or double) quotation marks.
 
Default None.
 
Object Model Reference
IE [window.]document.all.elementID.title
TYPENN n/a   IE n/a   HTML 4
TYPE="MIMETYPE"Optional
 

An advisory about the content type of the destination document or resource. A browser might use this information to assist in preparing support for a resource requiring a multimedia player or plugin.

 
Example
<DIV TYPE="video/mpeg" HREF="ski4.mpeg">...</DIV>
 
Value
Case-insensitive MIME type. A catalog of registered MIME types is available from ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/.
 
Default None.